//
//  PPAbstractTableViewController.m
//  pickpic
//
//  Created by Jinxiao on 8/21/16.
//  Copyright © 2016 MicroDream. All rights reserved.
//

#import "PPAbstractTableViewController.h"
#import "PPAlbumEditContentViewController.h"
@interface PPAbstractTableViewController ()

@end

@implementation PPAbstractTableViewController
- (void)popViewPreviousController{
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];

    self.tableView.showsVerticalScrollIndicator = NO;
    self.tableView.showsHorizontalScrollIndicator = NO;
    self.tableView.backgroundColor = [UIColor colorWithRGBHex:0xf2f2f2];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    if (![self isKindOfClass:[PPAlbumEditContentViewController class]]) {
        
        if(self.tableView.tableFooterView == nil) {
            UIView *footerView = [[UIView alloc] init];
            footerView.backgroundColor = [UIColor clearColor];
            footerView.frame = CGRectMake(0, 0, CGFLOAT_MIN, CGFLOAT_MIN);
            self.tableView.tableFooterView = footerView;
        }
    }
}

- (void)setupBackItem{
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_back"] style:UIBarButtonItemStylePlain target:self action:@selector(popViewPreviousController)];
    UIBarButtonItem * spaceItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    //将宽度设为负值
    spaceItem.width = -2;
    
    if (IS_IPHONE_6_PLUS) {
        spaceItem.width = -6;
    }
    
    //将两个BarButtonItem都返回给NavigationItem
    spaceItem.tintColor = BLACK;
    leftItem.tintColor = BLACK;
    self.navigationItem.leftBarButtonItems = @[spaceItem,leftItem];
}
@end
